package com.zxq.lawenf.pojo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.zxq.common.pojo.BasePojo;

/**
 * 分类(模板)
 * @author 章晓琦
 */
public class ACate extends BasePojo<ACate>
{
	private int id;
	private String name;
	private String url;
	private byte cateType;
	private String content;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;

	/* 字符串描述 */
	private String statusStr;
	private String cateTypeStr ; 
	
	/* 存储所有状态的容器 */
	private Map<String,String> enumsMap = new TreeMap<String, String>();
	
	public Map<String, String> getEnumsMap()
	{
		// 根据状态值获取字符串描述
		ACateEnum[] usersEnums = ACateEnum.values();
		for (int i = 0; i < usersEnums.length; i++)
		{
			ACateEnum usersEnum = usersEnums[i];
			String key = usersEnum.toString() ; 
			enumsMap.put(key + "-" + usersEnum.getStatus() + "", usersEnum.getName());
		}
		return enumsMap;
	}

	public String getStatusStr()
	{
		ACateEnum[] values = ACateEnum.values();
		for (int i = 0; i < values.length; i++)
		{
			ACateEnum usersEnumTemp = values[i];
			/*
			 * toString:变量名 name:枚举的键, getstatus:枚举的值
			 */
			if (usersEnumTemp.toString().startsWith("STATUS"))
			{
				if (usersEnumTemp.getStatus() == this.status)
				{
					this.statusStr = usersEnumTemp.getName();
				}
			}
		}
		return statusStr;
	}
	
	public String getCateTypeStr()
	{
		ACateEnum[] values = ACateEnum.values();
		for (int i = 0; i < values.length; i++)
		{
			ACateEnum usersEnumTemp = values[i];
			/*
			 * toString:变量名 name:枚举的键, getstatus:枚举的值
			 */
			if (usersEnumTemp.toString().startsWith("CATETYPE"))
			{
				if (usersEnumTemp.getStatus() == this.cateType)
				{
					this.cateTypeStr = usersEnumTemp.getName();
				}
			}
			// System.out.println(adminsEnumTemp.getName() + "=====>" +
			// adminsEnumTemp.getStatus() + "--->" + adminsEnumTemp);
		}
		return cateTypeStr;
	}

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getUrl()
	{
		return url;
	}

	public void setUrl(String url)
	{
		this.url = url;
	}

	public byte getCateType()
	{
		return cateType;
	}

	public void setCateType(byte cateType)
	{
		this.cateType = cateType;
	}

	public String getContent()
	{
		return content;
	}

	public void setContent(String content)
	{
		this.content = content;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getPubTime()
	{
		return pubTime;
	}

	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}
}
